import Packet from "../net/Packet"

// 创建角色成功
export default class AccountRoleCreateOk {
	/**
	 * @param rid 角色ID
	 */
	public constructor(public rid: Long) { }

	public encode(): Packet {
		const packet = this._encode()
		packet.Encode(2080)
		return packet
	}

	public encodeMsg(): ByteBuffer {
		return this._encode().GetBuffer()
	}

	public static decode(packet: Packet): AccountRoleCreateOk {
		const rid = packet.ReadUlong()
		return new AccountRoleCreateOk(rid)
	}

	private _encode(): Packet {
		const packet = new Packet()
		packet.WriteUlong(this.rid)
		return packet
	}
}
